package com.xuetang9.t9.hotel.mapper;

import com.xuetang9.t9.hotel.beans.CommodityType;
import com.xuetang9.t9.hotel.mapper.condition.ICondition;
import com.xuetang9.t9.hotel.mapper.sql.impl.CommodityTypeMapperSql;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Pang
 */
public interface ICommodityTypeMapper {

    /**
     * 新增商品类型
     * @param commodityType
     * @return
     */
    @Insert("INSERT INTO g_commoditytype(commetype_name,comm_comm) VALUES(#{commetypeName},#{commComm}) ")
    int insert(CommodityType commodityType);

    /**
     * 删除商品类型
     * @param id
     * @return
     */
    @Delete("DELETE FROM g_commoditytype WHERE #{id}")
    int delete(@Param("id") Integer id);

    /**
     * 更新商品类型
     * @param commodityType
     * @return
     */
    @Update("UPDATE g_commoditytype SET commetype_name=#{commetypeName},comm_comm=#{commComm}")
    int update(CommodityType commodityType);

    /**
     * 根据条件查询商品类型
     * @param condition
     * @return
     */
    @SelectProvider(value = CommodityTypeMapperSql.class,method = "selectByAll")
    List<CommodityType> selectByAll(@Param("key") ICondition condition);

    /**
     * 根据条件查询商品类型数量
     * @param condition
     * @return
     */
    @SelectProvider(value = CommodityTypeMapperSql.class,method = "selectByCount")
    Long selectByCount(@Param("key") ICondition condition);
}
